<template>
    <fieldset>
        <legend>计数器</legend>
        <button @click="DECREASE">-</button>
        &nbsp;
        <b>{{$store.state.money}}</b>
        &nbsp;
        <button @click="INCREASE">+</button>
        <h1>{{name}}</h1>
    </fieldset>
</template>
<script>
import { mapMutations, mapState } from 'vuex';
export default{
    mounted () {
        console.log(this.$store.state);
        console.log(this);
    },
    computed: {
        ...mapState(['name']),
        // name(){
        //     return this.$store.state.name
        // }
    },
    methods:{
        ...mapMutations(['INCREASE','DECREASE']),
        // increase(){
        //     this.$store.commit('INCREASE',10)
        // },
        // decrease(){
        //     this.$store.commit('DECREASE',11)
        // },
    }
}
</script>













